@extends('layout.main') 

@section('content')
<div class="content">

	<h1>{{$post->title}}</h1>
	<div class="descr">{{$post->created_at}} by fafaseo</div>

	{{$post->body}} 
	
	
	@if (count($comments))
	<!-- commentList start  -->
	<div class="commentList" style="padding: 20px;">
       <h2>评论列表</h2>
		@foreach($comments as $comment)
		<div class="lists">
			<h3>Email:{{$comment->email}}</h3>
			<p>
			 {{$comment->comment}}
			</p>
			<p>
    			<a href="#recomment" class="replay">@回复</a>  
			 </p>
		</div>
		@endforeach

		<div class="recomment" id="recomment"  style="padding: 20px;display:none;" >
    		{{Form::open(['url'=>'comment', 'class'=>'form-horizontal'])}}
    		{{Form::token()}}
    		<div>{{Form::label('inputemail', '邮箱', ['class'=>'control-label'])}}
    			{{Form::text('email','', ['placeholder'=>'请填写邮箱!',
    			'id'=>'inputemail'])}}</div>
    		<h3>{{Form::label('inputComment', '评论内容',
    			['class'=>'control-label'])}}</h3>
    		<div>{{Form::textarea('comment','', ['placeholder'=>'请填写评论内容!',
    			'id'=>'inputComment'])}}</div>
    		{{Form::hidden('post_id',$post->id)}}
    		{{Form::hidden('status',2)}}
    		{{Form::hidden('pid',$comment->id,['id'=>'pid'])}}
    		<div>{{Form::submit('保存添加', ['class'=>'btn btn-success'])}}</div>
    		{{Form::close()}}
    	</div>
		
	</div>
	<!-- commentList end  -->
	@endif

	<div class="comment"  style="padding: 20px;">
	
	{{ HTML::ul($errors->all()) }}
    <!-- will be used to show any messages -->
    @if (Session::has('message'))
    	<div class="alert alert-info">{{ Session::get('message') }}</div>
    @endif

		{{Form::open(['url'=>'comment', 'class'=>'form-horizontal'])}}
		{{Form::token()}}
		<div>{{Form::label('inputemail', '邮箱', ['class'=>'control-label'])}}
			{{Form::text('email','', ['placeholder'=>'请填写邮箱!',
			'id'=>'inputemail'])}}</div>
		<h3>{{Form::label('inputComment', '评论内容',
			['class'=>'control-label'])}}</h3>
		<div>{{Form::textarea('comment','', ['placeholder'=>'请填写评论内容!',
			'id'=>'inputComment'])}}</div>
		{{Form::hidden('post_id',$post->id)}}
		{{Form::hidden('status',2)}}
		{{Form::hidden('pid',0,['id'=>'pid'])}}
		<div>{{Form::submit('保存添加', ['class'=>'btn btn-success'])}}</div>
		{{Form::close()}}
	</div>
</div>


{{HTML::script('js/jquery.js')}}
<script type="text/javascript">
<!--
$(function(){
	$('.replay').click(function(){
	    $('.recomment').fadeIn() ; 
	});
});
//-->
</script>

@stop

